<?php if (!defined('SERVER_ROOT')) {exit('No direct script access allowed');}
//header
$this->template->title = 'Viết lớp giảng dạy';
$this->template->display('dsp_header.php');
?>
 <form name="frmMain" id="frmMain" action="" method="POST">
    <?php
    echo $this->hidden('controller',$this->get_controller_url());
    echo $this->hidden('hdn_item_id','0');
    echo $this->hidden('hdn_item_id_list','');

    echo $this->hidden('hdn_dsp_single_method','dsp_single_lopcovan');
    echo $this->hidden('hdn_dsp_all_method','dsp_all_lopcovan');
    echo $this->hidden('hdn_update_method','update_lopcovan');
    echo $this->hidden('hdn_delete_method','delete_lopcovan');
    $v_row = 0;
    ?>
   <div id="div_filter">
        <input class = 'button' type="button" name="btn_add_lopcovan" value="Thêm lớp cố vấn" onclick="row_lopcovan_onclick_pop_win('0')"/>
	</div>
    <table  width="100%" class="adminlist" cellspacing="0" border="1">
        <colgroup>
            <col width="15%" />
            <col width="25%" />
            <col width="20%" />
            <col width="10%" />
            <col width="12%" />
            <col width="8%" />
        </colgroup>
        <tr>
            <th>Mã lớp dạy</th>
            <th>Tên lớp dạy</th>
            <th>Học kỳ</th>
            <th>Số SV</th>
            <th>Số giờ chuẩn</th>
            <th>Thao tác</th>
        </tr>
        <?php while ($arr = $arr_all_lopcovan->FetchRow()): ?>
            <?php
            $id=1;
             $MA_LOP_CO_VAN=$arr['MA_LOP_CO_VAN'];
             $MA_LOP_HOC=$arr['MA_LOP_HOC'];
             $TEN_LOP_HOC=$arr['TEN_LOP_HOC'];
             $SO_LUONG_SINH_VIEN=$arr['SO_LUONG_SINH_VIEN'];
             $TEN_HOC_KY=$arr['TEN_HOC_KY'];
             $SO_GIO_CHUAN_QUI_DOI=$arr['SO_GIO_CHUAN_QUI_DOI'];
             $v_class = 'row' . ($v_row % 2);
             $v_row++;
            ?>
            <tr class="<?php echo $v_class;?>">
                <td style="text-align:center"><?php echo $MA_LOP_HOC;?></td>
                <td ><?php echo $TEN_LOP_HOC;?></td>
                <td ><?php echo $TEN_HOC_KY;?></td>
                <td style="text-align:center"><?php echo $SO_LUONG_SINH_VIEN;?></td>
                <td style="text-align:center"><?php echo $SO_GIO_CHUAN_QUI_DOI;?></td>
                <td style="text-align:center">
                    <a href="javascript:void(0)" onclick="row_lopcovan_onclick_pop_win('<?php echo $MA_LOP_CO_VAN;?>')">Sửa</a> |
                    <a href="javascript:void(0)" onclick="quick_delete_lopcovan('<?php echo $MA_LOP_CO_VAN;?>')">Xoá</a>
                </td>
            </tr>
        <?php endwhile; ?>
        <?php echo $this->add_empty_rows($v_row +1, _CONST_DEFAULT_ROWS_PER_PAGE, 6); ?>
    </table>

</form>
<script>
    function row_lopcovan_onclick_pop_win(malopcovan){
        var url = '<?php echo $this->get_controller_url();?>dsp_single_lopcovan/'  + malopcovan
            url += '/?&malopcovan=' + malopcovan + '&hdn_item_id=' + malopcovan + '&pop_win=1';
        showPopWin(url ,600,350, null);
    }
    function quick_delete_lopcovan(malopcovan)
    {
        var f = document.frmMain;
        if (confirm('Bạn chắc chắn xoá đối tượng đã chọn?')){
            f.hdn_item_id.value =  malopcovan;
            m = $("#controller").val() + 'delete_lopcovan'
            $("#frmMain").attr("action", m);
            f.submit();
        }
    }
</script>
<?php $this->template->display('dsp_footer.php');